/*
 * ******************************************************************************
 *   Copyright (c) 2013-2014 Gabriele Mariotti.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *  *****************************************************************************
 */

package it.gmariotti.cardslib.demo.fragment.v1;

import it.gmariotti.cardslib.demo.ResourceTable;
import it.gmariotti.cardslib.demo.cards.GooglePlaySmallCard;
import it.gmariotti.cardslib.demo.cards.GplayCard;
import it.gmariotti.cardslib.library.view.CardView;
import ohos.aafwk.content.Intent;
import ohos.agp.components.ScrollView;

/**
 * Card Examples
 *
 * @author Gabriele Mariotti (gabri.mariotti@gmail.com)
 */
public class GPlayCardFragment extends MaterialV1Fragment {

    protected ScrollView mScrollView;
    private GooglePlaySmallCard cardGmap;
    private CardView cardViewGmap;

    @Override
    protected int getSubTitleHeaderResourceId() {
        return ResourceTable.String_header_title_subtitle_ex_gplay;
    }

    @Override
    protected int getTitleHeaderResourceId() {
        return ResourceTable.String_header_title_group2;
    }

    @Override
    protected String getDocUrl() {
        return "";
    }

    @Override
    protected String getSourceUrl() {
        return "";
    }

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        setUIContent(ResourceTable.Layout_demo_fragment_gplay_card);
        mScrollView = (ScrollView) this.findComponentById(ResourceTable.Id_card_scrollview);

        initCardSmallCard();
        initCardGooglePlay();
    }

    /**
     * This method builds a simple card
     */
    private void initCardSmallCard() {

        //Create a Card
        cardGmap = new GooglePlaySmallCard(this);
        cardGmap.setId("gplaysmall");

        //Set card in the cardView
        cardViewGmap = (CardView) this.findComponentById(ResourceTable.Id_carddemo_gmaps);
        cardViewGmap.setCard(cardGmap);
    }


    /**
     * This method builds a simple card
     */
    private void initCardGooglePlay() {

        //Create a Card
        GplayCard card = new GplayCard(this);

        //Set card in the cardView
        CardView cardView = (CardView) this.findComponentById(ResourceTable.Id_carddemo_Gplay1);
        cardView.setCard(card);

        //Create a Card
        GplayCard card2 = new GplayCard(this);

        //Set card in the cardView
        CardView cardView2 = (CardView) this.findComponentById(ResourceTable.Id_carddemo_Gplay2);
        cardView2.setCard(card2);

//        if (Utils.isTablet(this)){
//            //Create a Card
//            GplayCard card3= new GplayCard(this);
//
//            //Set card in the cardView
////            CardView cardView3 = (CardView) this.findComponentById(ResourceTable.Id_carddemo_Gplay3);
////            if (cardView3!=null)
////                cardView3.setCard(card3);
//        }
    }

}
